#include <iostream>
#include <unistd.h>
#include <signal.h>

void handler(int sig)
{
    std::cout << "捕捉到一个信号，编号是: " << sig << std::endl;
}

int main()
{
    signal(SIGINT, handler);
    while (true)
    {
        std::cout << "i am a process, my pid is " << getpid() << std::endl;
        sleep(1);
    }
    return 0;
}